package com.ahnchan.ContactsPlus;

import com.ahnchan.ContactsPlus.util.WordUtils;

/**
 * Contact information 
 * 
 * @author Ahnchan
 *
 */
public class Contact {

	private String mID;	// ID
	private String mContactID;	// internal contact id (don't use)
	private String mName;	// Name (to sort)
	private String mDisplayName;	// displayed name // Add 20110426 by Ahnchan
	private String mCount;	// don't use
	private String mMember;	 // don't use (just use in Company)
	private String mSearchKey;
	private boolean mShow;	// visible or invisible
	
	public String getID() {
		return mID;
	}
	
	public String getContactID() {
		return mContactID;
	}
	
	public String getName() {
		return mName;
	}
	
	public String getDisplayName() {
		return mDisplayName;
	}

	public String getCount() {
		return mCount;
	}
	
	public String getMember() {
		return mMember;
	}
	
	public String getSearchKey() {
		return mSearchKey;
	}

	public void setShow(boolean show) {
		mShow = show;
	}
	
	public boolean getShow() {
		return mShow;
	}
	
	/**
	 * Constructor
	 * 
	 * @param id
	 * @param contactID
	 * @param name
	 * @param count
	 * @param member
	 * @param searchKey
	 */
	public Contact(String id, String contactID, String name, String displayName, int count, String member, String searchKey) {
		mID = id;
		mContactID = contactID;
		mName = name;
		mDisplayName = displayName;
		mCount = ""+count;
		mMember = member;
		mSearchKey = searchKey;
		
		mShow = false;
	}
	
	/**
	 * to search initial 
	 * @param search
	 * @return
	 */
	public boolean isThis(String search) {
		
		boolean bResult = false;
		
		if (WordUtils.isInitialSound(mName, search) ||	// English Initial search
   		    WordUtils.isHangulInitialSound(mName, search) ||	// Korean ChoSun search
   			(mName.toUpperCase().indexOf(search.toUpperCase()) >= 0)	// Match string
   			) {
    			
			// Find
			bResult = true;
		}
		
		return bResult;
		
	}

}
